<?php

/*
 * File  : aksi_statik.php
 * Table : statiks, kategoris
 */
session_start();
//cek session

if (!$_SESSION["USRID"] AND !$_SESSION["USRPASS"]) {
    header("location: ../index.php");
    exit();
}
//end
?>

<?php

include "../../../library/fungsi.lib.php";

$module = $_GET["module"];
$opr = $_GET["opr"];

// hapus statik
if ($module == 'statik' AND $opr == 'hapus') {
      mysql_query("DELETE FROM statiks WHERE statik_id='" . $_GET["id"] . "'");
    header('location:' . URLHOST . 'cms/hansip.php?module=' . $module);

// input statik
} elseif ($module == 'statik' AND $opr == 'input') {
    $statik_nama = $_POST["in_statik_nama"];
    $statik_seo = seo_title($_POST["in_statik_nama"]);
    $statik_deskripsi = $_POST["in_statik_deskripsi"];
    
        $sql = "INSERT INTO statiks(statik_nama,
                                    statik_seo,
                                    statik_isi
									)                            
									VALUES('$statik_nama',
                                   '$statik_seo',
                                   '$statik_deskripsi'
                                   )";
    

    //echo $sql;
    mysql_query($sql);
    header('location:' . URLHOST . 'cms/hansip.php?module=' . $module);
}

// update statik
elseif ($module == 'statik' AND $opr == 'update') {
    $statik_nama = $_POST["in_statik_nama"];
    $statik_seo = seo_title($_POST["in_statik_nama"]);
    $statik_deskripsi = $_POST["in_statik_deskripsi"];
    $statik_id = $_POST["id"];

        $sql = "UPDATE statiks SET  statik_nama='$statik_nama',
                                    statik_seo='$statik_seo',
                                    statik_isi='$statik_deskripsi'
                WHERE statik_id='$statik_id'";
   
    //echo $sql;
    mysql_query($sql);
    header('location:' . URLHOST . 'cms/hansip.php?module=' . $module);
}
?>
